//路径 /my/
var express = require('express');
var router = express.Router();
var {shoopListModel} = require('../model/model')

router.get('/myShoopList',async(req,res)=>{
  let data = await shoopListModel.find()
  res.send({
    code:200,
    data
  })
})
 //修改上架下架
 router.post('/myShoopupdate',async(req,res)=>{
  let {_id} = req.body
  await shoopListModel.updateOne({_id},{$set:{shelfOrNot:!req.body.shelfOrNot}})
  res.send({
    code:200,
    msg:'修改成功'
  })
 })

module.exports = router;
